using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace ArchSoft
{
    public class Exfnct
    {
        #region " For File! "

        public static void MoveDirectory(string strSourceDir, string strDestDir, bool bDelSource)
        {
            if (Directory.Exists(strSourceDir))
            {
                try
                {
                    CopyDirectory(new DirectoryInfo(strSourceDir), new DirectoryInfo(strDestDir));
                }
                catch (Exception subEx)
                {
                    throw subEx;
                }
            }
        }

        public static void CopyDirectory(DirectoryInfo diSourceDir, DirectoryInfo diDestDir)
        {
            if (!diDestDir.Exists) diDestDir.Create();
            FileInfo[] fiSrcFiles = diSourceDir.GetFiles();
            foreach (FileInfo fiSrcFile in fiSrcFiles)
            {
                fiSrcFile.CopyTo(Path.Combine(diDestDir.FullName, fiSrcFile.Name));
            }
            DirectoryInfo[] diSrcDirectories = diSourceDir.GetDirectories();
            foreach (DirectoryInfo diSrcDirectory in diSrcDirectories)
            {
                CopyDirectory(diSrcDirectory, new DirectoryInfo(Path.Combine(diDestDir.FullName, diSrcDirectory.Name)));
            }
        }

        #endregion

    }
}
